package com.itheima.mapper;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {
    @Select("select * from tb_user")
    List<User> findAll();

    @Select("select * from tb_user where id = #{id}")
    User findById(Integer id);

    @Update("update tb_user set username = #{name} where id =#{id}")
    int update(User user);

    @Insert("insert into tb_user values(id=null,username=#{name})")
    int save(User user);
}
